home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes ƒ / Ripple wipe.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.4 KB  |  51 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 1
  4. #define theWindowWidth (boundsRect.right-boundsRect.left)
  5. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  6.  
  7. pascal short RippleWipe(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  8.  
  9. /* Like the Caste wipe up, except the screen is split into 6 sections, and the
  10.    caste wipe is performed in each section -- hence the ripple effect. */
  11.    
  12. pascal short RippleWipe(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  13. {
  14.     short            bigy, littley, barpos;
  15.     Rect            src, dest;
  16.     short            BigRippleSize;
  17.     short            gap;
  18.     RgnHandle        boundsRgn;
  19.     
  20.     BigRippleSize=theWindowHeight/6;    /* used to be 52 */
  21.     gap=BigRippleSize/6;                /* used to be 8 */
  22.     boundsRgn=NewRgn();
  23.     RectRgn(boundsRgn, &boundsRect);
  24.     src.left = boundsRect.left;
  25.     src.right = boundsRect.right;
  26.     
  27.     for(bigy = 0; bigy < theWindowHeight; bigy += BigRippleSize)
  28.     {
  29.         for(littley = bigy; littley < bigy + BigRippleSize; littley += gap)
  30.         {
  31.             for(barpos = bigy; barpos + gap < bigy + BigRippleSize; barpos += gap) {}
  32.             for(; barpos >= littley; barpos -= gap)
  33.             {
  34.                 StartTiming();
  35.                 src.top = boundsRect.top + littley;
  36.                 src.bottom = boundsRect.top + littley + gap;
  37.                 dest = src;
  38.                 dest.top = boundsRect.top + barpos;
  39.                 dest.bottom = dest.top + gap;
  40.                 CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  41.                         &src, &dest, 0, boundsRgn);
  42.                 TimeCorrection(CorrectTime);
  43.             }
  44.         }
  45.     }
  46.     
  47.     DisposeRgn(boundsRgn);
  48.     
  49.     return 0;
  50. }
  51.